package com.sxbbc.common.core.service;

import java.util.Map;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.function.common.RestResponse;
import com.sxbbc.common.core.dto.jz.FarmLogisticsOrderOutVo;
import com.sxbbc.common.core.entity.jz.OrderExpDetail;
import com.sxbbc.common.core.entity.jz.OrderMain;
import com.sxbbc.common.core.utils.BasePage;

/**
 * <p>
 * 订单主表信息 服务类
 * </p>
 *
 * @author xiaoky
 * @since 2019-05-09
 */
public interface IOrderMainService extends IService<OrderMain> {
	/**
	 * 通过订单编号查询订单
	 * @param orderCode 
	 * @return OrderMain
	 */
	OrderMain getByOrderCode(String orderCode);


	/**
	 * 获取线下订单状态角标
	 * @param orderMain 订单查询条件
	 * @return Map
	 * @author xiaoky
	 */
	Map<String, Integer> getOfflineOrderNum(OrderMain orderMain);


	/**
	 * 获取订单状态角标
	 * @param orderMain 订单查询条件
	 * @return Map
	 * @author xiaoky
	 */
	Map<String, Integer> getOrderNum(OrderMain orderMain);

	/**
	 * 查询订单列表
	 * @param orderMain 订单查询条件
	 * @return IPage<OrderMain>
	 * @author xiaoky
	 */
	IPage<OrderMain> queryOrder(BasePage<OrderMain> page, OrderMain orderMain);

	/**
	 * 查询订单详情
	 * @param orderId
	 * @return OrderMain
	 * @author xiaoky
	 */
	OrderMain getOrderDetailById(Integer orderId);
	
	/**
	 * 订单发货操作
	 * @param orderId 
	 * @param receivedType 发货方式
	 * @param expName 快递公司名称
	 * @param expNo 快递单号
	 * @return RestResponse
	 */
	RestResponse handleSendGood(Integer orderId, Integer receivedType, String expCode, String expName, String expNo);

	/**
	 * 订单发货操作
	 * 为了区分自营（多仓库发货，扣仓库库存）与非自营
	 * @param expDetail
	 * @author leehao
	 */
	RestResponse handleOrderDeliver(OrderExpDetail expDetail);

	/**
	 * 处理订单修改发货单
	 * @param expDetail
	 * @return
	 * @author xiaoky
	 */
	RestResponse handleUpdateSendCode(OrderExpDetail expDetail);

	/**
	 * 修改收货信息
	 * @param expDetail
	 * @return
	 * @author xiaoky
	 */
	RestResponse editOrderReceive(OrderExpDetail expDetail);

	/**
	 * 退款订单明细
	 * @return
	 */
	IPage<OrderMain> queryBusinessOrderRefundDetail(BasePage<OrderMain> page, OrderMain orderMain,Integer timeDays);

	/**
	 * 获取物流提鸡订单
	 * @param page
	 * @param orderMain
	 * @return
	 */
    IPage<FarmLogisticsOrderOutVo> selectChickenLogisticsOrderList(BasePage<OrderMain> page, OrderMain orderMain);
}
